<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>moduleloader.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="local_closure_goog_module_moduleloader.js.html">moduleloader.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2008 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>/**
<a name="line16"></a> * @fileoverview The module loader for loading modules across the network.
<a name="line17"></a> *
<a name="line18"></a> * Browsers do not guarantee that scripts appended to the document
<a name="line19"></a> * are executed in the order they are added. For production mode, we use
<a name="line20"></a> * XHRs to load scripts, because they do not have this problem and they
<a name="line21"></a> * have superior mechanisms for handling failure. However, XHR-evaled
<a name="line22"></a> * scripts are harder to debug.
<a name="line23"></a> *
<a name="line24"></a> * In debugging mode, we use normal script tags. In order to make this work,
<a name="line25"></a> * we load the scripts in serial: we do not execute script B to the document
<a name="line26"></a> * until we are certain that script A is finished loading.
<a name="line27"></a> *
<a name="line28"></a> */
<a name="line29"></a>
<a name="line30"></a>goog.provide(&#39;goog.module.ModuleLoader&#39;);
<a name="line31"></a>
<a name="line32"></a>goog.require(&#39;goog.Timer&#39;);
<a name="line33"></a>goog.require(&#39;goog.array&#39;);
<a name="line34"></a>goog.require(&#39;goog.events&#39;);
<a name="line35"></a>goog.require(&#39;goog.events.Event&#39;);
<a name="line36"></a>goog.require(&#39;goog.events.EventHandler&#39;);
<a name="line37"></a>goog.require(&#39;goog.events.EventTarget&#39;);
<a name="line38"></a>goog.require(&#39;goog.log&#39;);
<a name="line39"></a>goog.require(&#39;goog.module.AbstractModuleLoader&#39;);
<a name="line40"></a>goog.require(&#39;goog.net.BulkLoader&#39;);
<a name="line41"></a>goog.require(&#39;goog.net.EventType&#39;);
<a name="line42"></a>goog.require(&#39;goog.net.jsloader&#39;);
<a name="line43"></a>goog.require(&#39;goog.userAgent.product&#39;);
<a name="line44"></a>
<a name="line45"></a>
<a name="line46"></a>
<a name="line47"></a>/**
<a name="line48"></a> * A class that loads Javascript modules.
<a name="line49"></a> * @constructor
<a name="line50"></a> * @extends {goog.events.EventTarget}
<a name="line51"></a> * @implements {goog.module.AbstractModuleLoader}
<a name="line52"></a> */
<a name="line53"></a>goog.module.ModuleLoader = function() {
<a name="line54"></a>  goog.module.ModuleLoader.base(this, &#39;constructor&#39;);
<a name="line55"></a>
<a name="line56"></a>  /**
<a name="line57"></a>   * Event handler for managing handling events.
<a name="line58"></a>   * @type {goog.events.EventHandler.&lt;!goog.module.ModuleLoader&gt;}
<a name="line59"></a>   * @private
<a name="line60"></a>   */
<a name="line61"></a>  this.eventHandler_ = new goog.events.EventHandler(this);
<a name="line62"></a>
<a name="line63"></a>  /**
<a name="line64"></a>   * A map from module IDs to goog.module.ModuleLoader.LoadStatus.
<a name="line65"></a>   * @type {!Object.&lt;Array.&lt;string&gt;, goog.module.ModuleLoader.LoadStatus&gt;}
<a name="line66"></a>   * @private
<a name="line67"></a>   */
<a name="line68"></a>  this.loadingModulesStatus_ = {};
<a name="line69"></a>};
<a name="line70"></a>goog.inherits(goog.module.ModuleLoader, goog.events.EventTarget);
<a name="line71"></a>
<a name="line72"></a>
<a name="line73"></a>/**
<a name="line74"></a> * A logger.
<a name="line75"></a> * @type {goog.log.Logger}
<a name="line76"></a> * @protected
<a name="line77"></a> */
<a name="line78"></a>goog.module.ModuleLoader.prototype.logger = goog.log.getLogger(
<a name="line79"></a>    &#39;goog.module.ModuleLoader&#39;);
<a name="line80"></a>
<a name="line81"></a>
<a name="line82"></a>/**
<a name="line83"></a> * Whether debug mode is enabled.
<a name="line84"></a> * @type {boolean}
<a name="line85"></a> * @private
<a name="line86"></a> */
<a name="line87"></a>goog.module.ModuleLoader.prototype.debugMode_ = false;
<a name="line88"></a>
<a name="line89"></a>
<a name="line90"></a>/**
<a name="line91"></a> * Whether source url injection is enabled.
<a name="line92"></a> * @type {boolean}
<a name="line93"></a> * @private
<a name="line94"></a> */
<a name="line95"></a>goog.module.ModuleLoader.prototype.sourceUrlInjection_ = false;
<a name="line96"></a>
<a name="line97"></a>
<a name="line98"></a>/**
<a name="line99"></a> * @return {boolean} Whether sourceURL affects stack traces.
<a name="line100"></a> *     Chrome is currently the only browser that does this, but
<a name="line101"></a> *     we believe other browsers are working on this.
<a name="line102"></a> * @see http://bugzilla.mozilla.org/show_bug.cgi?id=583083
<a name="line103"></a> */
<a name="line104"></a>goog.module.ModuleLoader.supportsSourceUrlStackTraces = function() {
<a name="line105"></a>  return goog.userAgent.product.CHROME;
<a name="line106"></a>};
<a name="line107"></a>
<a name="line108"></a>
<a name="line109"></a>/**
<a name="line110"></a> * @return {boolean} Whether sourceURL affects the debugger.
<a name="line111"></a> */
<a name="line112"></a>goog.module.ModuleLoader.supportsSourceUrlDebugger = function() {
<a name="line113"></a>  return goog.userAgent.product.CHROME || goog.userAgent.GECKO;
<a name="line114"></a>};
<a name="line115"></a>
<a name="line116"></a>
<a name="line117"></a>/**
<a name="line118"></a> * Gets the debug mode for the loader.
<a name="line119"></a> * @return {boolean} Whether the debug mode is enabled.
<a name="line120"></a> */
<a name="line121"></a>goog.module.ModuleLoader.prototype.getDebugMode = function() {
<a name="line122"></a>  return this.debugMode_;
<a name="line123"></a>};
<a name="line124"></a>
<a name="line125"></a>
<a name="line126"></a>/**
<a name="line127"></a> * Sets the debug mode for the loader.
<a name="line128"></a> * @param {boolean} debugMode Whether the debug mode is enabled.
<a name="line129"></a> */
<a name="line130"></a>goog.module.ModuleLoader.prototype.setDebugMode = function(debugMode) {
<a name="line131"></a>  this.debugMode_ = debugMode;
<a name="line132"></a>};
<a name="line133"></a>
<a name="line134"></a>
<a name="line135"></a>/**
<a name="line136"></a> * When enabled, we will add a sourceURL comment to the end of all scripts
<a name="line137"></a> * to mark their origin.
<a name="line138"></a> *
<a name="line139"></a> * On WebKit, stack traces will refect the sourceURL comment, so this is
<a name="line140"></a> * useful for debugging webkit stack traces in production.
<a name="line141"></a> *
<a name="line142"></a> * Notice that in debug mode, we will use source url injection + eval rather
<a name="line143"></a> * then appending script nodes to the DOM, because the scripts will load far
<a name="line144"></a> * faster.  (Appending script nodes is very slow, because we can&#39;t parallelize
<a name="line145"></a> * the downloading and evaling of the script).
<a name="line146"></a> *
<a name="line147"></a> * The cost of appending sourceURL information is negligible when compared to
<a name="line148"></a> * the cost of evaling the script. Almost all clients will want this on.
<a name="line149"></a> *
<a name="line150"></a> * TODO(nicksantos): Turn this on by default. We may want to turn this off
<a name="line151"></a> * for clients that inject their own sourceURL.
<a name="line152"></a> *
<a name="line153"></a> * @param {boolean} enabled Whether source url injection is enabled.
<a name="line154"></a> */
<a name="line155"></a>goog.module.ModuleLoader.prototype.setSourceUrlInjection = function(enabled) {
<a name="line156"></a>  this.sourceUrlInjection_ = enabled;
<a name="line157"></a>};
<a name="line158"></a>
<a name="line159"></a>
<a name="line160"></a>/**
<a name="line161"></a> * @return {boolean} Whether we&#39;re using source url injection.
<a name="line162"></a> * @private
<a name="line163"></a> */
<a name="line164"></a>goog.module.ModuleLoader.prototype.usingSourceUrlInjection_ = function() {
<a name="line165"></a>  return this.sourceUrlInjection_ ||
<a name="line166"></a>      (this.getDebugMode() &amp;&amp;
<a name="line167"></a>       goog.module.ModuleLoader.supportsSourceUrlStackTraces());
<a name="line168"></a>};
<a name="line169"></a>
<a name="line170"></a>
<a name="line171"></a>/** @override */
<a name="line172"></a>goog.module.ModuleLoader.prototype.loadModules = function(
<a name="line173"></a>    ids, moduleInfoMap, opt_successFn, opt_errorFn, opt_timeoutFn,
<a name="line174"></a>    opt_forceReload) {
<a name="line175"></a>  var loadStatus = this.loadingModulesStatus_[ids] ||
<a name="line176"></a>      new goog.module.ModuleLoader.LoadStatus();
<a name="line177"></a>  loadStatus.loadRequested = true;
<a name="line178"></a>  loadStatus.successFn = opt_successFn || null;
<a name="line179"></a>  loadStatus.errorFn = opt_errorFn || null;
<a name="line180"></a>
<a name="line181"></a>  if (!this.loadingModulesStatus_[ids]) {
<a name="line182"></a>    // Modules were not prefetched.
<a name="line183"></a>    this.loadingModulesStatus_[ids] = loadStatus;
<a name="line184"></a>    this.downloadModules_(ids, moduleInfoMap);
<a name="line185"></a>    // TODO(user): Need to handle timeouts in the module loading code.
<a name="line186"></a>  } else if (goog.isDefAndNotNull(loadStatus.responseTexts)) {
<a name="line187"></a>    // Modules prefetch is complete.
<a name="line188"></a>    this.evaluateCode_(ids);
<a name="line189"></a>  }
<a name="line190"></a>  // Otherwise modules prefetch is in progress, and these modules will be
<a name="line191"></a>  // executed after the prefetch is complete.
<a name="line192"></a>};
<a name="line193"></a>
<a name="line194"></a>
<a name="line195"></a>/**
<a name="line196"></a> * Evaluate the JS code.
<a name="line197"></a> * @param {Array.&lt;string&gt;} moduleIds The module ids.
<a name="line198"></a> * @private
<a name="line199"></a> */
<a name="line200"></a>goog.module.ModuleLoader.prototype.evaluateCode_ = function(moduleIds) {
<a name="line201"></a>  this.dispatchEvent(new goog.module.ModuleLoader.Event(
<a name="line202"></a>      goog.module.ModuleLoader.EventType.REQUEST_SUCCESS, moduleIds));
<a name="line203"></a>
<a name="line204"></a>  goog.log.info(this.logger, &#39;evaluateCode ids:&#39; + moduleIds);
<a name="line205"></a>  var success = true;
<a name="line206"></a>  var loadStatus = this.loadingModulesStatus_[moduleIds];
<a name="line207"></a>  var uris = loadStatus.requestUris;
<a name="line208"></a>  var texts = loadStatus.responseTexts;
<a name="line209"></a>  try {
<a name="line210"></a>    if (this.usingSourceUrlInjection_()) {
<a name="line211"></a>      for (var i = 0; i &lt; uris.length; i++) {
<a name="line212"></a>        var uri = uris[i];
<a name="line213"></a>        goog.globalEval(texts[i] + &#39; //@ sourceURL=&#39; + uri);
<a name="line214"></a>      }
<a name="line215"></a>    } else {
<a name="line216"></a>      goog.globalEval(texts.join(&#39;\n&#39;));
<a name="line217"></a>    }
<a name="line218"></a>  } catch (e) {
<a name="line219"></a>    success = false;
<a name="line220"></a>    // TODO(user): Consider throwing an exception here.
<a name="line221"></a>    goog.log.warning(this.logger, &#39;Loaded incomplete code for module(s): &#39; +
<a name="line222"></a>        moduleIds, e);
<a name="line223"></a>  }
<a name="line224"></a>
<a name="line225"></a>  this.dispatchEvent(
<a name="line226"></a>      new goog.module.ModuleLoader.Event(
<a name="line227"></a>          goog.module.ModuleLoader.EventType.EVALUATE_CODE, moduleIds));
<a name="line228"></a>
<a name="line229"></a>  if (!success) {
<a name="line230"></a>    this.handleErrorHelper_(moduleIds, loadStatus.errorFn, null /* status */);
<a name="line231"></a>  } else if (loadStatus.successFn) {
<a name="line232"></a>    loadStatus.successFn();
<a name="line233"></a>  }
<a name="line234"></a>  delete this.loadingModulesStatus_[moduleIds];
<a name="line235"></a>};
<a name="line236"></a>
<a name="line237"></a>
<a name="line238"></a>/**
<a name="line239"></a> * Handles a successful response to a request for prefetch or load one or more
<a name="line240"></a> * modules.
<a name="line241"></a> *
<a name="line242"></a> * @param {goog.net.BulkLoader} bulkLoader The bulk loader.
<a name="line243"></a> * @param {Array.&lt;string&gt;} moduleIds The ids of the modules requested.
<a name="line244"></a> * @private
<a name="line245"></a> */
<a name="line246"></a>goog.module.ModuleLoader.prototype.handleSuccess_ = function(
<a name="line247"></a>    bulkLoader, moduleIds) {
<a name="line248"></a>  goog.log.info(this.logger, &#39;Code loaded for module(s): &#39; + moduleIds);
<a name="line249"></a>
<a name="line250"></a>  var loadStatus = this.loadingModulesStatus_[moduleIds];
<a name="line251"></a>  loadStatus.responseTexts = bulkLoader.getResponseTexts();
<a name="line252"></a>
<a name="line253"></a>  if (loadStatus.loadRequested) {
<a name="line254"></a>    this.evaluateCode_(moduleIds);
<a name="line255"></a>  }
<a name="line256"></a>
<a name="line257"></a>  // NOTE: A bulk loader instance is used for loading a set of module ids.
<a name="line258"></a>  // Once these modules have been loaded successfully or in error the bulk
<a name="line259"></a>  // loader should be disposed as it is not needed anymore. A new bulk loader
<a name="line260"></a>  // is instantiated for any new modules to be loaded. The dispose is called
<a name="line261"></a>  // on a timer so that the bulkloader has a chance to release its
<a name="line262"></a>  // objects.
<a name="line263"></a>  goog.Timer.callOnce(bulkLoader.dispose, 5, bulkLoader);
<a name="line264"></a>};
<a name="line265"></a>
<a name="line266"></a>
<a name="line267"></a>/** @override */
<a name="line268"></a>goog.module.ModuleLoader.prototype.prefetchModule = function(
<a name="line269"></a>    id, moduleInfo) {
<a name="line270"></a>  // Do not prefetch in debug mode.
<a name="line271"></a>  if (this.getDebugMode()) {
<a name="line272"></a>    return;
<a name="line273"></a>  }
<a name="line274"></a>  var loadStatus = this.loadingModulesStatus_[[id]];
<a name="line275"></a>  if (loadStatus) {
<a name="line276"></a>    return;
<a name="line277"></a>  }
<a name="line278"></a>
<a name="line279"></a>  var moduleInfoMap = {};
<a name="line280"></a>  moduleInfoMap[id] = moduleInfo;
<a name="line281"></a>  this.loadingModulesStatus_[[id]] = new goog.module.ModuleLoader.LoadStatus();
<a name="line282"></a>  this.downloadModules_([id], moduleInfoMap);
<a name="line283"></a>};
<a name="line284"></a>
<a name="line285"></a>
<a name="line286"></a>/**
<a name="line287"></a> * Downloads a list of JavaScript modules.
<a name="line288"></a> *
<a name="line289"></a> * @param {Array.&lt;string&gt;} ids The module ids in dependency order.
<a name="line290"></a> * @param {Object} moduleInfoMap A mapping from module id to ModuleInfo object.
<a name="line291"></a> * @private
<a name="line292"></a> */
<a name="line293"></a>goog.module.ModuleLoader.prototype.downloadModules_ = function(
<a name="line294"></a>    ids, moduleInfoMap) {
<a name="line295"></a>  var uris = [];
<a name="line296"></a>  for (var i = 0; i &lt; ids.length; i++) {
<a name="line297"></a>    goog.array.extend(uris, moduleInfoMap[ids[i]].getUris());
<a name="line298"></a>  }
<a name="line299"></a>  goog.log.info(this.logger, &#39;downloadModules ids:&#39; + ids + &#39; uris:&#39; + uris);
<a name="line300"></a>
<a name="line301"></a>  if (this.getDebugMode() &amp;&amp;
<a name="line302"></a>      !this.usingSourceUrlInjection_()) {
<a name="line303"></a>    // In debug mode use &lt;script&gt; tags rather than XHRs to load the files.
<a name="line304"></a>    // This makes it possible to debug and inspect stack traces more easily.
<a name="line305"></a>    // It&#39;s also possible to use it to load JavaScript files that are hosted on
<a name="line306"></a>    // another domain.
<a name="line307"></a>    // The scripts need to load serially, so this is much slower than parallel
<a name="line308"></a>    // script loads with source url injection.
<a name="line309"></a>    goog.net.jsloader.loadMany(uris);
<a name="line310"></a>  } else {
<a name="line311"></a>    var loadStatus = this.loadingModulesStatus_[ids];
<a name="line312"></a>    loadStatus.requestUris = uris;
<a name="line313"></a>
<a name="line314"></a>    var bulkLoader = new goog.net.BulkLoader(uris);
<a name="line315"></a>
<a name="line316"></a>    var eventHandler = this.eventHandler_;
<a name="line317"></a>    eventHandler.listen(
<a name="line318"></a>        bulkLoader,
<a name="line319"></a>        goog.net.EventType.SUCCESS,
<a name="line320"></a>        goog.bind(this.handleSuccess_, this, bulkLoader, ids));
<a name="line321"></a>    eventHandler.listen(
<a name="line322"></a>        bulkLoader,
<a name="line323"></a>        goog.net.EventType.ERROR,
<a name="line324"></a>        goog.bind(this.handleError_, this, bulkLoader, ids));
<a name="line325"></a>    bulkLoader.load();
<a name="line326"></a>  }
<a name="line327"></a>};
<a name="line328"></a>
<a name="line329"></a>
<a name="line330"></a>/**
<a name="line331"></a> * Handles an error during a request for one or more modules.
<a name="line332"></a> * @param {goog.net.BulkLoader} bulkLoader The bulk loader.
<a name="line333"></a> * @param {Array.&lt;string&gt;} moduleIds The ids of the modules requested.
<a name="line334"></a> * @param {number} status The response status.
<a name="line335"></a> * @private
<a name="line336"></a> */
<a name="line337"></a>goog.module.ModuleLoader.prototype.handleError_ = function(
<a name="line338"></a>    bulkLoader, moduleIds, status) {
<a name="line339"></a>  var loadStatus = this.loadingModulesStatus_[moduleIds];
<a name="line340"></a>  // The bulk loader doesn&#39;t cancel other requests when a request fails. We will
<a name="line341"></a>  // delete the loadStatus in the first failure, so it will be undefined in
<a name="line342"></a>  // subsequent errors.
<a name="line343"></a>  if (loadStatus) {
<a name="line344"></a>    delete this.loadingModulesStatus_[moduleIds];
<a name="line345"></a>    this.handleErrorHelper_(moduleIds, loadStatus.errorFn, status);
<a name="line346"></a>  }
<a name="line347"></a>
<a name="line348"></a>  // NOTE: A bulk loader instance is used for loading a set of module ids. Once
<a name="line349"></a>  // these modules have been loaded successfully or in error the bulk loader
<a name="line350"></a>  // should be disposed as it is not needed anymore. A new bulk loader is
<a name="line351"></a>  // instantiated for any new modules to be loaded. The dispose is called
<a name="line352"></a>  // on another thread so that the bulkloader has a chance to release its
<a name="line353"></a>  // objects.
<a name="line354"></a>  goog.Timer.callOnce(bulkLoader.dispose, 5, bulkLoader);
<a name="line355"></a>};
<a name="line356"></a>
<a name="line357"></a>
<a name="line358"></a>/**
<a name="line359"></a> * Handles an error during a request for one or more modules.
<a name="line360"></a> * @param {Array.&lt;string&gt;} moduleIds The ids of the modules requested.
<a name="line361"></a> * @param {?function(?number)} errorFn The function to call on failure.
<a name="line362"></a> * @param {?number} status The response status.
<a name="line363"></a> * @private
<a name="line364"></a> */
<a name="line365"></a>goog.module.ModuleLoader.prototype.handleErrorHelper_ = function(
<a name="line366"></a>    moduleIds, errorFn, status) {
<a name="line367"></a>  this.dispatchEvent(
<a name="line368"></a>      new goog.module.ModuleLoader.Event(
<a name="line369"></a>          goog.module.ModuleLoader.EventType.REQUEST_ERROR, moduleIds));
<a name="line370"></a>
<a name="line371"></a>  goog.log.warning(this.logger, &#39;Request failed for module(s): &#39; + moduleIds);
<a name="line372"></a>
<a name="line373"></a>  if (errorFn) {
<a name="line374"></a>    errorFn(status);
<a name="line375"></a>  }
<a name="line376"></a>};
<a name="line377"></a>
<a name="line378"></a>
<a name="line379"></a>/** @override */
<a name="line380"></a>goog.module.ModuleLoader.prototype.disposeInternal = function() {
<a name="line381"></a>  goog.module.ModuleLoader.superClass_.disposeInternal.call(this);
<a name="line382"></a>
<a name="line383"></a>  this.eventHandler_.dispose();
<a name="line384"></a>  this.eventHandler_ = null;
<a name="line385"></a>};
<a name="line386"></a>
<a name="line387"></a>
<a name="line388"></a>/**
<a name="line389"></a> * @enum {string}
<a name="line390"></a> */
<a name="line391"></a>goog.module.ModuleLoader.EventType = {
<a name="line392"></a>  /** Called after the code for a module is evaluated. */
<a name="line393"></a>  EVALUATE_CODE: goog.events.getUniqueId(&#39;evaluateCode&#39;),
<a name="line394"></a>
<a name="line395"></a>  /** Called when the BulkLoader finishes successfully. */
<a name="line396"></a>  REQUEST_SUCCESS: goog.events.getUniqueId(&#39;requestSuccess&#39;),
<a name="line397"></a>
<a name="line398"></a>  /** Called when the BulkLoader fails, or code loading fails. */
<a name="line399"></a>  REQUEST_ERROR: goog.events.getUniqueId(&#39;requestError&#39;)
<a name="line400"></a>};
<a name="line401"></a>
<a name="line402"></a>
<a name="line403"></a>
<a name="line404"></a>/**
<a name="line405"></a> * @param {goog.module.ModuleLoader.EventType} type The type.
<a name="line406"></a> * @param {Array.&lt;string&gt;} moduleIds The ids of the modules being evaluated.
<a name="line407"></a> * @constructor
<a name="line408"></a> * @extends {goog.events.Event}
<a name="line409"></a> * @final
<a name="line410"></a> */
<a name="line411"></a>goog.module.ModuleLoader.Event = function(type, moduleIds) {
<a name="line412"></a>  goog.module.ModuleLoader.Event.base(this, &#39;constructor&#39;, type);
<a name="line413"></a>
<a name="line414"></a>  /**
<a name="line415"></a>   * @type {Array.&lt;string&gt;}
<a name="line416"></a>   */
<a name="line417"></a>  this.moduleIds = moduleIds;
<a name="line418"></a>};
<a name="line419"></a>goog.inherits(goog.module.ModuleLoader.Event, goog.events.Event);
<a name="line420"></a>
<a name="line421"></a>
<a name="line422"></a>
<a name="line423"></a>/**
<a name="line424"></a> * A class that keeps the state of the module during the loading process. It is
<a name="line425"></a> * used to save loading information between modules download and evaluation.
<a name="line426"></a> * @constructor
<a name="line427"></a> * @final
<a name="line428"></a> */
<a name="line429"></a>goog.module.ModuleLoader.LoadStatus = function() {
<a name="line430"></a>  /**
<a name="line431"></a>   * The request uris.
<a name="line432"></a>   * @type {Array.&lt;string&gt;}
<a name="line433"></a>   */
<a name="line434"></a>  this.requestUris = null;
<a name="line435"></a>
<a name="line436"></a>  /**
<a name="line437"></a>   * The response texts.
<a name="line438"></a>   * @type {Array.&lt;string&gt;}
<a name="line439"></a>   */
<a name="line440"></a>  this.responseTexts = null;
<a name="line441"></a>
<a name="line442"></a>  /**
<a name="line443"></a>   * Whether loadModules was called for the set of modules referred by this
<a name="line444"></a>   * status.
<a name="line445"></a>   * @type {boolean}
<a name="line446"></a>   */
<a name="line447"></a>  this.loadRequested = false;
<a name="line448"></a>
<a name="line449"></a>  /**
<a name="line450"></a>   * Success callback.
<a name="line451"></a>   * @type {?function()}
<a name="line452"></a>   */
<a name="line453"></a>  this.successFn = null;
<a name="line454"></a>
<a name="line455"></a>  /**
<a name="line456"></a>   * Error callback.
<a name="line457"></a>   * @type {?function(?number)}
<a name="line458"></a>   */
<a name="line459"></a>  this.errorFn = null;
<a name="line460"></a>};
</pre>


</body>
</html>
